# Filename: jit-mda-transfer-image.sh
# Usage: jit-mda-transfer-image.sh <image name> <destination>
# Example: jit-mda-transfer-image.sh vm01 10.0.0.1
#
# Transfers a disk snapshot file and the VM configuration file
# from the image provider to a destination host ( primary or backup )
# on predetermined folders.

imagename=$1
destination=$2
LOCALFOLDER=/tmp
USER=root
REMOTEIMAGEFOLDER=/tmp
VMCONFIG=/etc/xen
DRBDPATH=/etc/drbd.d

echo `date +%H:%M:%S` Starting Script $0 $*
if [ -z "$imagename" -o -z "$destination" ]; then
	echo Incorrect parameters
	echo "Usage: $0 <image name> <destination>"
else
	scp $LOCALFOLDER/$imagename ${USER}@${destination}:$REMOTEIMAGEFOLDER
	scp $VMCONFIG/$imagename.cfg ${USER}@${destination}:$VMCONFIG
fi
echo `date +%H:%M:%S` Finishing Script $0
exit 0
